home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1996 #6 / Amiga Plus CD - 1996 - No. 06.iso / pd / daten / abook / arexx / sendmess.abx < prev    next >
Text File  |  1995-09-13  |  8KB  |  243 lines

  1. /*
  2. **  $VER: sendmess.rexx 02.01ß (06.09.95) © Aris Basic
  3. **
  4. **
  5. **  PROGRAMNAME:
  6. **      sendmess.rexx
  7. **
  8. **  FUNCTION:
  9. **      Sends a message via MicroDot from Address-Book (© Jörg Krause).
  10. **
  11. **      This macro needs MicroDot 1.10 by © Oliver Wagner
  12. **      Its possible that also works with older MD but i`m not sure.
  13. **
  14. **  $HISTORY:
  15. **
  16. **   28.12.94 : 01.12 : initial release
  17. **   12.01.95 : 01.15 : subject can have now spaces(thes will be converted TO underline "_")
  18. **   12.01.95 : 01.20 : problems with path "Ram Disk" are now gone this path will be converted
  19. **                      "RAM".Editor it`s now user will it must not be ED.Added Support
  20. **                      FOR uuencoding binar Files with user choice OF program.
  21. **   11.02.95 : 01.50 : now script use ABook Server(1.30+) wenn needed this means that script
  22. **                      must not be Started from ABook actualy he don`t need ABook because
  23. **                      script will than use ABook Server.
  24. **   02.03.95 : 01.51 : liltle bug removed (after message sending MD givs no more requests)
  25. **   01.05.95 : 02.00 : version for ABook 0.40 Beta and (i hope) 1.00
  26. **   06.09.95 : 02.01ß: full addapted on ABook 01.00
  27. */
  28.  
  29. edcmd='GED'
  30. edsufix='STICKY SCREEN=WORKBENCH'
  31.  
  32. /*
  33. **  Editor Commands Examples:
  34. **
  35. **  GoldED © Dietmar Eilert:
  36. **
  37. **            edcmd='GED'
  38. **         edsufix1='STICKY'                   <- This Suffix must be in VAR sufix you use GoldED
  39. **         edsufix2='STICKY SCREEN=WORKBENCH'  <- Suffix FOR GoldED on Workbench Screen
  40. **                                                change ScreenName IF you want another
  41. **                                                PUBLIC Screen
  42. **
  43. **  ED © Commodore Amiga INC.:
  44. **
  45. **            edcmd='ED '
  46. **          edsufix=''                         <- I don`t know any usefull Argument FOR ED
  47. **
  48. **
  49. **  In Script Command Actualy IS : edcmd||' T:mess.ascii '||edsufix
  50. **
  51. **
  52. */
  53.  
  54. uuencmd='UUxt a'
  55. uuenin=' '
  56. uuensufix=''
  57.  
  58. /*
  59. **  UUEncode Commands Examples:
  60. **
  61. **  UUxt © Asher Feldman:
  62. **
  63. **          uuencmd='UUxt -a'
  64. **           uuenin=' '                         <- When Somebody need FOR own UUencode package
  65. **        uuensufix=''                          <- See UP ^
  66. **
  67. **
  68. **  UUencode Author ?:
  69. **
  70. **          uuencmd='uuenode'
  71. **           uuenin=' >'
  72. **        uuensufix=''
  73. **
  74. **
  75. **
  76. **
  77. **  In Script Command Actualy IS : uuencmd||' '||file||'.uu'||uuenin||file||' '||uuensufix
  78. **
  79. **
  80. */
  81.  
  82. OPTIONS RESULTS       
  83. CR=D2C(13)
  84. IF ~Show('P','ADDRESS_BOOK.1') THEN DO
  85.                                   IF ~Show('P','ABOOK_SERVER') THEN DO
  86.                                                                     SAY 'Kann Address-Book oder ABook-Server nicht finden !!'
  87.                                                                     EXIT 10
  88.                                   END
  89.                                   CALL server()
  90. END
  91. ADDRESS 'ADDRESS_BOOK.1'
  92. checkMD()
  93. 'LOCKGUI'                                 
  94. 'FIRST SELECTED'
  95. lock=RESULT
  96. 'UNLOCKGUI'
  97. IF lock=0 THEN CALL server()
  98. main:
  99. 'LOCK ENTRY='lock
  100. IF RC=10 THEN DO
  101.                  'REQUESTRESPONSE PROMPT="Ungültiger Lock" TITLE="FEHLER" BUTTON="_OK"'
  102.                   CALL error()
  103. END                 
  104. 'QUERY STEM=DATA.'
  105. IF DATA.EMAIL.COUNT=0 THEN CALL noemail()
  106. IF DATA.EMAIL.COUNT>1 THEN em=morethenone()
  107. IF DATA.EMAIL.COUNT=1 THEN em=1
  108. email=getemail(em)
  109. lemail=LENGTH(email)
  110. IF lemail=0 THEN DO
  111.                               'REQUESTRESPONSE PROMPT="Eintrag hat keine EMail-Adresse" TITLE="FEHLER"
  112.                               BUTTON="_OK"'
  113.                               CALL noemail()
  114. END
  115. 'REQUESTRESPONSE PROMPT="Art der Nachricht" TITLE="ANFRAGE" BUTTON="_KURZ|_DATEI|_ABBRUCH"'
  116. button=RESULT
  117. SELECT
  118.       WHEN button=0 THEN CALL ex()
  119.       WHEN button=1 THEN DO
  120.                              'REQUESTSTRING PROMPT="Nachricht:" DEFAULT="Hallo Ruf mich an!" TITLE="ANFRAGE"'
  121.                              nachricht=RESULT
  122.                              file='T:mess.ascii'
  123.                              OPEN(tmp,file,'WRITE')
  124.                              WRITELN(tmp,nachricht)
  125.                              CLOSE(tmp)
  126.                              filetyp=1
  127.                          END
  128.       WHEN button=2 THEN DO
  129.                              'REQUESTRESPONSE PROMPT="Was fuer eine Datei ?" TITLE="ANFRAGE"
  130.                              BUTTON="_ALT(ASCII)|ALT(_BIN)|_NEU(ASCII)"'
  131.                              button2=RESULT
  132.                              IF button2=0 THEN DO
  133.                                                ADDRESS COMMAND  edcmd||' T:mess.ascii '||edsufix
  134.                                                file='T:mess.ascii'
  135.                                                filetyp=1
  136.                              END
  137.                              IF button2=1 THEN DO
  138.                                                'REQUESTFILE TITLE="ASCII-Datei:"'
  139.                                                IF RC=5 THEN CALL ex()
  140.                                                file=RESULT
  141.                                                filetyp=1
  142.                                                file=checkram(file)
  143.                              END
  144.                              IF button2=2 THEN DO
  145.                                                'REQUESTFILE TITLE="BIN-Datei:"'
  146.                                                IF RC=5 THEN CALL ex()
  147.                                                file=RESULT
  148.                                                filetyp=2
  149.                                                file=checkram(file)
  150.                                                'REQUESTRESPONSE PROMPT="Sie haben eine Binaerdatei ausgewaehlt.Soll ich diese UUEncoden?" TITLE="ANFRAGE" BUTTON="_JA|_NEIN"'
  151.                                                button3=RESULT
  152.                                                IF button3=1 THEN DO
  153.                                                                  ADDRESS COMMAND uuencmd||' '||file||'.uu'||uuenin||file||' '||uuensufix
  154.                                                                  file=file||'.uu'
  155.                                                                  filetyp=1
  156.                                                END
  157.                              END
  158.                         END
  159.      OTHERWISE CALL error()
  160. END
  161. 'REQUESTSTRING PROMPT="Betreff:" DEFAULT="Hallo" TITLE="ANFRAGE"'
  162. betreff=RESULT
  163. ADDRESS 'MICRODOT'
  164. NOREQUEST
  165. IF filetyp=1 THEN DO
  166. SendMail TO email BODYFILE file SUBJECT SPACE(betreff,1,'_')
  167. IF file='T:mess.ascii' THEN ADDRESS COMMAND 'Delete T:mess.ascii'
  168. END
  169. IF filetyp=2 THEN DO
  170. SendMail TO email BODYFILE file BIN SUBJECT betreff
  171. END
  172. NOREQUEST OFF
  173. ex:
  174. 'UNLOCK 'lock
  175. EXIT
  176. noemail:
  177. 'REQUESTRESPONSE PROMPT="Keine EMail in diesem Eintrag !" TITLE="FEHLER"'
  178. error:
  179. 'UNLOCK 'lock
  180. EXIT 10
  181.  
  182. PROCEDURE checkram:
  183. arg filename
  184. w1=WORD(filename,1)
  185. IF w1='RAM' THEN DO
  186.                  wl=LENGTH(filename)
  187.                  ramstr='RAM'
  188.                  filestr=SUBSTR(filename,9,wl-8)
  189.                  filen=ramstr||filestr
  190.                  RETURN filen
  191. END
  192. RETURN filename  
  193.  
  194. EXIT 0
  195.  
  196.  
  197.  
  198. PROCEDURE checkMD:
  199. IF ~Show('P','MICRODOT') THEN DO
  200.                          'REQUESTRESPONSE PROMPT="Kann MicroDot nicht finden !" TITLE="FEHLER" BUTTON="_OK"'
  201.                          EXIT 10
  202. END
  203. RETURN 0 
  204.  
  205. server:
  206. ADDRESS 'ABOOK_SERVER'
  207. 'SELECT STEM='VAR.
  208. lock=VAR.1
  209. CALL main() 
  210.  
  211. PROCEDURE morethenone:
  212. DO a=1 TO DATA.EMAIL.COUNT
  213.     SELECT
  214.         WHEN a=1 THEN buttons=DATA.EMAIL.1.DES
  215.         WHEN a=2 THEN buttons=buttons||DATA.EMAIL.2.DES
  216.         WHEN a=3 THEN buttons=buttons||DATA.EMAIL.3.DES
  217.         WHEN a=4 THEN buttons=buttons||DATA.EMAIL.4.DES
  218.         WHEN a=5 THEN buttons=buttons||DATA.EMAIL.5.DES
  219.         WHEN a=6 THEN buttons=buttons||DATA.EMAIL.6.DES
  220.     END
  221. checkandadd()
  222. END
  223. 'REQUESTRESPONSE PROMPT="Dieser Eintrag hat mehrere EMail Adressen.\nWelche soll benutzt werden?" TITLE="ANFRAGE" BUTTON='buttons
  224. IF RESULT=0 THEN ret=DATA.EMAIL.COUNT
  225.             ELSE ret=RESULT
  226. RETURN ret
  227.  
  228. PROCEDURE checkandadd:
  229. IF a<DATA.EMAIL.COUNT THEN buttons=buttons||'|'
  230. RETURN 0
  231.  
  232. PROCEDURE getemail:
  233. ARG nm
  234.     SELECT
  235.         WHEN nm=1 THEN ret=DATA.EMAIL.1.ADR
  236.         WHEN nm=2 THEN ret=DATA.EMAIL.2.ADR
  237.         WHEN nm=3 THEN ret=DATA.EMAIL.3.ADR
  238.         WHEN nm=4 THEN ret=DATA.EMAIL.4.ADR
  239.         WHEN nm=5 THEN ret=DATA.EMAIL.5.ADR
  240.         WHEN nm=6 THEN ret=DATA.EMAIL.6.ADR
  241.     END
  242. RETURN ret
  243.